package cn.bdqn.pro.controller;

import cn.bdqn.model.PageBean;
import cn.bdqn.pro.model.Transport;
import cn.bdqn.pro.service.TransportService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author gurilla
 * @create 2019-08-23 14:58
 */
@Controller
@RequestMapping("/pro/transport")
public class TransportController {
    //调用
    @Resource
    private TransportService transportService;

    @RequiresPermissions("pro:transport:page")
    @GetMapping
    public String topage(){
        return "/pro/transport";
    }

    @RequiresPermissions("pro:transport:list")
    @PostMapping("list")
    @ResponseBody
    public Object list(PageBean pageBean, String lname, String cname, String vidcard){
        return transportService.list(pageBean, lname, cname, vidcard);
    }

    @RequiresPermissions("pro:transport:save")
    @PostMapping("save")
    @ResponseBody
    public Object save(Transport transport){
        return transportService.save(transport);
    }

    @GetMapping("getleader")
    @ResponseBody
    public Object getLeader(){
        return transportService.getLeader().getData();
    }

    @GetMapping("getdriver")
    @ResponseBody
    public Object getDriver(){
        return transportService.getDriver().getData();
    }

    @GetMapping("gettrack")
    @ResponseBody
    public Object getTrack(){
        return transportService.getTrack().getData();
    }
}

